//
//  SearchAddressViewController.m
//  Hui
//
//  Created by HawkingWang on 16/10/28.
//  Copyright © 2016年 Hui. All rights reserved.
//

#import "SearchAddressViewController.h"
#import "NearbyTableViewCell.h"//附近cell

@interface SearchAddressViewController () <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, UIScrollViewDelegate>

@property (weak, nonatomic) IBOutlet UIView *searchbgView;
@property (weak, nonatomic) IBOutlet UITextField *searchTextField;
@property (weak, nonatomic) IBOutlet UITableView *searchTableView;

@end

@implementation SearchAddressViewController

 static NSString *const NearbyTableViewCellID = @"NearbyTableViewCell";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _searchTextField.text = _searchString;
    _searchbgView.layer.borderWidth = 1;
    _searchbgView.layer.borderColor = RGBCOLOR(226, 235, 241).CGColor;
    [_searchTableView registerNib:[UINib nibWithNibName:@"NearbyTableViewCell" bundle:nil] forCellReuseIdentifier:NearbyTableViewCellID];
}

#pragma mark === TableViewDelegate ===
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 6;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60.5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NearbyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NearbyTableViewCellID];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}


#pragma mark === UITextFieldDelegate ===
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    DLog(@"%@", textField.text);
    [_searchTextField resignFirstResponder];
    return YES;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    [_searchTextField resignFirstResponder];
}
- (IBAction)back:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
